#ifndef QGETFILE_H
#define QGETFILE_H

#include <QObject>
#include <QNetworkAccessManager>
#include <QNetworkReply>
#include <QUrl>
#include <QTimer>
#include <QDateTime>
#include <QFile>

class QGetFile : public QObject
{
    Q_OBJECT
public:
    explicit QGetFile(QObject *parent = 0);
    ~QGetFile();

    void    start(const QUrl &url);
    void    stop();
signals:
    void    offline();
    void    finish();
public slots:
    void    finished();
    void    readyRead();
    void    timer();
signals:
    void    progress(qint64 count,qint64 total);
protected:
    QNetworkAccessManager   m_manager;
    QNetworkReply           *m_reply;
    QTimer                  *m_timer;
    QDateTime               m_last_time;
    QFile                   m_file;
};

#endif // QGETFILE_H
